import { Page404Component } from './page404/page404.component';
import { FirstChildrendetailComponent } from './first-childrendetail/first-childrendetail.component';
import { FirstChildrenComponent } from './first-children/first-children.component';
import { SecondComponent } from './second/second.component';
import { FirstComponent } from './first/first.component';
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
  {path: '', redirectTo: '/first', pathMatch: 'full'},
  {
    path: 'first',
    component: FirstComponent,
    children: [
      {
        path: 'children',
        component: FirstChildrenComponent,
        children: [
          {path: '', component: FirstChildrendetailComponent}
        ]
      }
    ]
  },
  {path: 'second', component: SecondComponent},
  {path: '**', component: Page404Component}
];

@NgModule({
  declarations: [
    SecondComponent,
    FirstComponent,
    FirstChildrenComponent,
    FirstChildrendetailComponent,
    Page404Component
  ],
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
